<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    {if $auth->city_id == 0}
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-3">城市:</label>
        <div class="col-xs-12 col-sm-7">
            <input id="c-city_id" data-rule="required" data-source="general/lihua_city/index" data-order-by="weigh desc" class="form-control selectpage" name="row[city_id]" type="text" value="{$row.city_id|htmlentities}">
        </div>
    </div>
    {/if}
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-3">{:__('Name')}:</label>
        <div class="col-xs-12 col-sm-7">
            <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
        </div>
    </div>
    <div id="typeDiv" class="form-group">
        <label class="control-label col-xs-12 col-sm-3">{:__('Type')}:</label>
        <div class="col-xs-12 col-sm-7">
            <div class="radio" id="radio1">
            {foreach name="typeList" item="vo"}
            <label for="row[type]-{$key}"><input id="row[type]-{$key}" name="row[type]" type="radio" value="{$key}" {in name="key" value="$row.type"}checked{/in} /> {$vo}</label> 
            {/foreach}
            </div>
        </div>
    </div>
    {if $row.type==2}
    <div id="bonusDiv" class="form-group">
        <label class="control-label col-xs-12 col-sm-3">红包卡券:</label>
        <div class="col-xs-12 col-sm-7">
            <input id="c-bonus_id" data-rule="required" data-source="bonus/bonus/index" data-order-by="id desc" class="form-control selectpage" name="row[bonus_id]" type="text" value="{$row.bonus_id|htmlentities}">
        </div>
    </div>
    {/if}
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-3">{:__('Des')}:</label>
        <div class="col-xs-12 col-sm-7">
            <textarea class="form-control" name="row[des]" id="c-des" placeholder="可不填" cols="30" rows="4">{$row.des|htmlentities}</textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-3">{:__('Pic')}:</label>
        <div class="col-xs-12 col-sm-7">
            <div class="input-group">
                <input id="c-pic" class="form-control" size="50" name="row[pic]" type="text" placeholder="不传图片则使用默认图片" readonly value="{$row.pic|htmlentities}">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="plupload-pic" class="btn btn-danger plupload" data-input-id="c-pic" data-mimetype="image/gif,image/jpeg,image/png,image/jpg" data-url="xajax/uppic/group/score" data-maxsize="10M" data-multiple="false" data-preview-id="p-pic"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-pic"></span>
            </div>
            <ul class="row list-inline plupload-preview" id="p-pic"></ul>
        </div>
    </div>
    
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-3">{:__('Score')}:</label>
        <div class="col-xs-12 col-sm-7">
            <input id="c-score" data-rule="required" class="form-control" name="row[score]" type="number" value="{$row.score|htmlentities}">
        </div>
    </div>

    <div id="use_stockDiv" class="form-group">
        <label class="control-label col-xs-12 col-sm-3">是否启用库存:</label>
        <div class="col-xs-12 col-sm-7">
            <div class="radio" id="radio3">
                <label for="row[use_stock]-0"><input id="row[use_stock]-0" name="row[use_stock]" type="radio" value="0" {if $row.use_stock==0}checked{/if} /> 关闭</label>
                <label for="row[use_stock]-1"><input id="row[use_stock]-1" name="row[use_stock]" type="radio" value="1" {if $row.use_stock==1}checked{/if} /> 开启</label>
            </div>
        </div>
    </div>

    <div id="set_stock">
        <div id="set_stock_form">
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-3">库存设置:</label>
                <div class="col-xs-12 col-sm-7">
                    <input id="c-stock" name="row[stock]" type="number" class="form-control" value="{$row.stock}" />
                </div>
            </div>
        </div>
    </div>

    <div id="use_sale_timeDiv" class="form-group">
        <label class="control-label col-xs-12 col-sm-3">是否启用上架时间:</label>
        <div class="col-xs-12 col-sm-7">
            <div class="radio" id="radio2">
                <label for="row[use_sale_time]-0"><input id="row[use_sale_time]-0" name="row[use_sale_time]" type="radio" value="0" {if $row.use_sale_time==0}checked{/if} /> 关闭</label>
                <label for="row[use_sale_time]-1"><input id="row[use_sale_time]-1" name="row[use_sale_time]" type="radio" value="1" {if $row.use_sale_time==1}checked{/if} /> 开启</label>
            </div>
        </div>
    </div>

    <div id="set_saletime">
        <div id="sale_time_form">
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-3">上架开始:</label>
                <div class="col-xs-12 col-sm-7">
                    <input id="c-sale_start" data-rule="开始时间: datetime;" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[sale_start]" type="text" value="{$row.sale_start}">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-3">上架截止:</label>
                <div class="col-xs-12 col-sm-7">
                    <input id="c-sale_end" data-rule="结束时间: datetime;match(gte, row[sale_start], datetime)" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[sale_end]" type="text" value="{$row.sale_end}">
                </div>
            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-3">限兑数量:</label>
        <div class="col-xs-12 col-sm-7">
            <input id="c-limit_num" data-rule="required" class="form-control" name="row[limit_num]" type="number" value="{$row.limit_num}" placeholder="为0不限制">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-3">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-7">

            <div class="radio">
                {foreach name="statusList" item="vo"}
                <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
                {/foreach}
            </div>

        </div>
    </div>

    <div class="form-group layer-footer">
        <div class="text-center">
            <button type="submit" class="btn btn-success btn-embossed disabled">提交</button>
            <button type="button" class="btn btn-primary btn-embossed btn-close" onclick="Layer.closeAll();">关闭</button>
        </div>
    </div>
</form>
